home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / dflat8.zip / MENU.H < prev    next >
Text File  |  1991-07-28  |  2KB  |  64 lines

  1. /* ------------ menu.h ------------- */
  2.  
  3. #ifndef MENU_H
  4. #define MENU_H
  5.  
  6. #define MAXPULLDOWNS 10
  7. #define MAXSELECTIONS 15
  8. #define MAXCASCADES 3  /* nesting level of cascaded menus */
  9.  
  10. /* ----------- popdown menu selection structure
  11.        one for each selection on a popdown menu --------- */
  12. struct PopDown {
  13.     unsigned char *SelectionTitle; /* title of the selection */
  14.     int ActionId;          /* the command executed        */
  15.     int Accelerator;       /* the accelerator key         */
  16.     int Attrib;  /* INACTIVE | CHECKED | TOGGLE | CASCADED*/
  17.     char *help;            /* Help mnemonic               */
  18. };
  19.  
  20. /* ----------- popdown menu structure
  21.        one for each popdown menu on the menu bar -------- */
  22. typedef struct Menu {
  23.     char *Title;           /* title on the menu bar       */
  24.     void (*PrepMenu)(void *, struct Menu *); /* function  */
  25.     char *StatusText;      /* text for the status bar     */
  26.     int CascadeId;   /* command id of cascading selection */
  27.     int Selection;         /* most recent selection       */
  28.     struct PopDown Selections[MAXSELECTIONS+1];
  29. } MENU;
  30.  
  31. /* ----- one for each menu bar ----- */
  32. typedef struct MenuBar {
  33.     int ActiveSelection;
  34.     MENU PullDown[MAXPULLDOWNS+1];
  35. } MBAR;
  36.  
  37. /* --------- macros to define a menu bar with
  38.                  popdowns and selections ------------- */
  39. #define SEPCHAR "\xc4"
  40. #define DEFMENU(m) MBAR m = {-1,{
  41. #define POPDOWN(ttl,func,stat)     {ttl,func,stat,-1,0,{
  42. #define CASCADED_POPDOWN(id,func)  {NULL,func,NULL,id,0,{
  43. #define SELECTION(stxt,acc,id,attr)   {stxt,acc,id,attr,#acc},
  44. #define SEPARATOR                     {SEPCHAR},
  45. #define ENDPOPDOWN                    {NULL}}},
  46. #define ENDMENU                {(void *)-1} }};
  47.  
  48. /* -------- menu selection attributes -------- */
  49. #define INACTIVE    1
  50. #define CHECKED     2
  51. #define TOGGLE      4
  52. #define CASCADED    8    
  53.  
  54. /* --------- the standard menus ---------- */
  55. extern MBAR MainMenu;
  56. extern MBAR SystemMenu;
  57. extern MBAR *ActiveMenuBar;
  58.  
  59. int MenuHeight(struct PopDown *);
  60. int MenuWidth(struct PopDown *);
  61.  
  62. #endif
  63.  
  64.